package cn.aj.exm.service.impl;

import cn.aj.exm.domain.UserMovie;
import cn.aj.exm.mapper.UserMovieMapper;
import cn.aj.exm.result.JsonResult;
import cn.aj.exm.service.IUserMovieService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author GTR
 * @since 2023-01-02
 */
@Service
public class UserMovieServiceImpl extends ServiceImpl<UserMovieMapper, UserMovie> implements IUserMovieService {

    @Override
    public JsonResult userMovieLoadTicket(Long movieId, Long userId) {
        EntityWrapper<UserMovie> objectEntityWrapper = new EntityWrapper<>();
        objectEntityWrapper.eq("movie_ticket_id", movieId);
        objectEntityWrapper.eq("user_id", userId);
        UserMovie userMovie = selectOne(objectEntityWrapper);
        return JsonResult.success(userMovie);
    }
}
